/*
 * @Descripttion: 上海敦复项目公众号
 * @version: v1.0
 * @Author: Hou
 * @Date: 2021-09-02 18:56:57
 * @LastEditors: wangshengnan
 * @LastEditTime: 2022-03-01 12:09:13
 */
/* eslint-disable import/no-commonjs */
module.exports = {
  env: {
    NODE_ENV: '"production"',
  },
  defineConstants: {
    HOST: '',
  },
  mini: {},
  h5: {
    /**
     * 如果h5端编译后体积过大，可以使用webpack-bundle-analyzer插件对打包体积进行分析。
     * 参考代码如下：
     * webpackChain (chain) {
     *   chain.plugin('analyzer')
     *     .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
     * }
     */
    terser: {
      enable: true,
      config: {
        // 配置项同 https://github.com/terser/terser#minify-options
        mangle: true,
        compress: {
          drop_console: true,
          drop_debugger: true,
          pure_funcs: ['console.log'], // 移除console
        },
      },
    },
    // publicPath: 'https://business-platform.cdn.bcebos.com/follow-up-wx-doctor',
    publicPath: '/follow-up-wx-doctor',
    output: {
      filename: 'js/[name].[hash:8].js',
      chunkFilename: 'js/[name].[chunkhash:8].js',
    },
    imageUrlLoaderOption: {
      limit: 5000,
      name: 'static/images/[name].[hash:8].[ext]',
    },
    miniCssExtractPluginOption: {
      filename: 'css/[name].[hash:8].css',
      chunkFilename: 'css/[name].[chunkhash:8].css',
    },
  },
};
